<?php  
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * -----------------------------------------------------
 *
 * manage Setup
 *
 * @package     manage
 * @subpackage  
 * @category    Setup - 网站设置
 * @author      DongChao
 * @since       2015-07-04 version 1.0
 * -----------------------------------------------------    
 */
class Setup extends CI_Controller{
	
	public function __construct(){
		parent::__construct();
		$this->load->helper(array('form', 'url'));
		$this->load->model('setup_model','setup');    // 加载链接模型
		check_login(); // 检查是否登录
	}

	/**
	 * 网站信息读取与设置
	 */
	public function index(){
		if(!empty($_POST['title'])){
			$id=$_GET['id']; 
			//接收表单信息
			$arr            	=$this->input->post();
			$data['title']  	=$arr['title'];
			$data['desc']   	=$arr['desc'];
			$data['keyword']	=$arr['keyword'];
			$data['copyright']	=$arr['copyright'];
			$data['filings']	=$arr['filings'];

			if($this->setup->edit($data,$id)){//修改网站信息
				$this->sys_message->skip('设置成功',site_url('manage/setup'));
				return false;
			}else{
				$this->sys_message->show_error('设置失败');
				return false;
			}
			
		}
		$res=$this->setup->getAll();	//获取网站基本信息
		$this->load->view('admin/setup/index',compact("res"));
	}
}

?>